<template>
  <a-layout>
    <a-layout-header class="header">
      <div class="logo" />
      <a-menu
        theme="dark"
        mode="horizontal"
        v-model:selectedKeys="selectedKeys1"
        :style="{ lineHeight: '64px' }"
      >
        <a-menu-item key="1">超级管理员</a-menu-item>
      </a-menu>
    </a-layout-header>
    <a-layout-content style="padding: 0 50px">
      <a-breadcrumb style="margin: 16px 0">
        <a-breadcrumb-item>Home</a-breadcrumb-item>
        <a-breadcrumb-item>List</a-breadcrumb-item>
      </a-breadcrumb>
      <a-layout style="padding: 24px 0; background: #fff">
        <a-layout-sider width="200" style="background: #fff">
          <a-menu
            mode="inline"
            v-model:selectedKeys="selectedKeys2"
            v-model:openKeys="openKeys"
            style="height: 100%"
          >
            <a-sub-menu key="sub1">
              <template #title>
                <span>
                  <user-outlined />
                  后台用户
                </span>
              </template>
              <a-menu-item key="1" @click="manage">后台用户管理</a-menu-item>
              <a-menu-item key="2" @click="apply">后台用户申请</a-menu-item>
            </a-sub-menu>
            <a-sub-menu key="sub2">
              <template #title>
                <span>
                  <laptop-outlined />
                  个人中心
                </span>
              </template>
              <a-menu-item key="3" @click="own">个人信息</a-menu-item>
            </a-sub-menu>
          </a-menu>
        </a-layout-sider>
        <a-layout-content :style="{ padding: '0 24px', minHeight: '500px' }">
          <router-view></router-view>
        </a-layout-content>
      </a-layout>
    </a-layout-content>
    <a-layout-footer style="text-align: center">
      Community ©2021 Designed by ZHAO YU
    </a-layout-footer>
  </a-layout>
</template>
<script setup>
import { UserOutlined, LaptopOutlined, NotificationOutlined } from '@ant-design/icons-vue';
import { ref, reactive} from 'vue';
import { useRouter } from "vue-router";

const router = useRouter(); //获取路由器

const selectedKeys1 = ref(['1']);
const selectedKeys2 = ref(['1']);
const openKeys = ref(['sub1'])

const manage = () => {
  console.log("后台用户管理");
  router.push({ path: "/admin/home/busermanage" });
};
const apply = () => {
  console.log("后台用户申请");
  router.push({ path: "/admin/home/buserApply" });
};
const own = () => {
  console.log("个人中心");
  router.push({ path: "/admin/home/info" });
};
</script>
<style>
#components-layout-demo-top-side .logo {
  float: left;
  width: 120px;
  height: 31px;
  margin: 16px 24px 16px 0;
  background: rgba(255, 255, 255, 0.3);
}

.ant-row-rtl #components-layout-demo-top-side .logo {
  float: right;
  margin: 16px 0 16px 24px;
}

.site-layout-background {
  background: #fff;
}
</style>